﻿using DF.Core.Data;
using DF.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DF.Service
{
    public class TestService:ITestService
    {
        //public TestService(IRepository<business> _BusinessRepository, IRepository<users> _UserRepository)
        //{
        //    BusinessRepository = _BusinessRepository;
        //    UserRepository = _UserRepository;
        //}

        /// <summary>
        /// 商户仓储
        /// </summary>
        public IRepository<business> BusinessRepository { protected get; set; }

        public IRepository<users> UserRepository { protected get; set; }
        public void TestMethod()
        {
            BusinessRepository.UnitOfWork.TransactionEnabled = true;
            business bus = new business();
            bus.AddTime = DateTime.Now;
            bus.AliPayRate = 1;
            bus.BusinessId = 1;
            bus.BusinessName = "2";
            bus.PID = Guid.NewGuid().ToString();
            bus.SHOPID = Guid.NewGuid().ToString();
            bus.State = 1;
            bus.StoreName = "5";
            bus.Type = 2;
            BusinessRepository.Insert(bus);

            users u = new users();
            u.AddTime = DateTime.Now;
            u.Mobile = "123";
            u.OPENID = "123";
            u.State = 1;
            u.Tag = "2";
            u.UserId = 222;
            u.UserName = "333";
            UserRepository.Insert(u);
            BusinessRepository.UnitOfWork.SaveChanges();
        }
    }
}
